package com.mall.ibatis.persistence.sqlmapdao;

import java.sql.SQLException;
import java.util.List;

import com.mall.ibatis.bean.Method;
import com.mall.ibatis.bean.Operator;
import com.mall.ibatis.persistence.iface.MethodDAO;
import com.ibatis.dao.client.DaoManager;

public class MethodOracleDAO extends BaseSqlMapDao implements MethodDAO{

	public MethodOracleDAO(DaoManager daoManager) {
		super(daoManager);
	}
	//方法的删除
	public int deleteMethod(String id) throws SQLException{
		return delete("delete_method",id);
	}
	//方法的更新
	public int updateMethod(Method method){
		return update("update_method",method);
	}
	
	//方法的增加
	public String addMethod(Method method){
		return (String)insert("add_method",method);
	}
	//方法列表的加载
	@SuppressWarnings("unchecked")
	public List<Method> selectAllMethod() {
		return (List<Method>)queryForList("select_all_method",null);
	}
	
	//方法的Id查找有哪些用户
	@SuppressWarnings("unchecked")
	public List<Operator> selectUserList(String methodId) {
		return queryForList("search_user_list",methodId);
	}
	
	//获取放法的Id号
	public String getMethodId() {
		return (String) queryForObject("get_method_id",null);
	}
	
}
